﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _9jCardRegisterCollection.Utils
{
    public class Validation
    {
        public static bool CheckEmpty(AntdUI.Window window, AntdUI.Input edit, string desc)
        {
            if (!string.IsNullOrWhiteSpace(edit.Text)) return true;

            AntdUI.Message.warn(window, desc, autoClose: 3);
            edit.Focus();
            return false;
        }

        public static bool CheckEmpty(AntdUI.Window window, AntdUI.Dropdown edit, string desc)
        {
            if (edit.SelectedValue != null && !string.IsNullOrWhiteSpace(edit.SelectedValue?.ToString())) return true;

            AntdUI.Message.warn(window, desc, autoClose: 3);
            edit.Focus();
            return false;
        }

        public static bool CheckEmpty(AntdUI.Window window, AntdUI.Select edit, string desc)
        {
            if (edit.SelectedValue != null && !string.IsNullOrWhiteSpace(edit.SelectedValue?.ToString())) return true;

            AntdUI.Message.warn(window, desc, autoClose: 3);
            edit.Focus();
            return false;
        }
    }
}
